package fr.babostesting.unit.components.text
{
	import flash.events.Event;
	import fr.babos.core.entries.Document;
	import fr.babos.graphic.components.base.BorderComponent;
	import fr.babos.graphic.components.base.ResizableComponent;
	import fr.babos.graphic.components.base.StageWrapper;
	import fr.babos.graphic.components.bitmaps.AdvancedBitmap;
	import fr.babos.graphic.components.controls.text.NativeTextInput;
	import fr.babos.graphic.components.controls.text.TextSkin;
	
	/**
	 * @author ZoulouX
	 */
	public class NativeTextInputTest extends Document
	{
		protected var _wrapper:StageWrapper;
		protected var _textInput:NativeTextInput;
		protected var _textInput2:NativeTextInput;
		
		public function NativeTextInputTest ()
		{
			
		}
		
		override public function init ():void
		{
			_wrapper = new StageWrapper(stage);
			
			var container:ResizableComponent = new ResizableComponent();
			container.place(10, 10, 10, 10).into(_wrapper);
			
			(new BorderComponent(0x0000FF, 2)).place(0, 0, 0, 0).into(container);
			
			_textInput = new NativeTextInput(true);
			_textInput.place(NaN, 0, 0, 0).size(NaN, 24).into(container);
			
			(new BorderComponent(0xFF0000, 2)).place(0, 0, 0, 0).into(_textInput);
			
			
			_textInput.textSkin(new TextSkin({
				font: "arial",
				size: 16,
				bold: true,
				color: 0xFF0000,
				align: "center"
			}));
			
			_textInput.text = "Super ipsum mega truc";
			
			//_textInput.autoRasterize = true;
			
			_textInput.addEventListener(Event.CHANGE, textChangeHandler);
			
			var front:AdvancedBitmap = new AdvancedBitmap(null, null, 1, 0x00FF00);
			front.size(50, 100).place(NaN, NaN, 10, NaN).center(0, NaN).into(container);
			
			
			_textInput2 = new NativeTextInput(false);
			_textInput2.place(0, 0, NaN, 0).size(NaN, 24).into(container);
			
			(new BorderComponent(0xFF0000, 2)).place(0, 0, 0, 0).into(_textInput2);
			
		}
		
		protected function textChangeHandler (event:Event):void
		{
			trace(event);
		}
	}
}